add_executable(CybertronBridgeIO "")

#include_directories("${BRIDGE_IO_ROOT}/SimOneIOAPI")
include_directories("${CYBERTRON_PATH_FOUNDATION}/Source/Worker/BridgeIO")
include_directories("${CYBERTRON_PATH_FOUNDATION}/Source/CoreLibrary/include")
include_directories("${CYBERTRON_PATH_FOUNDATION}/Source/Worker/BaseLibrary/BridgeBase/include")
include_directories("${CYBERTRON_PATH_FOUNDATION}/Source/Worker/BaseLibrary/SensorBase/include")
include_directories("${CYBERTRON_PATH_FOUNDATION}/Source/Protocol/Output/cpp")
include_directories("${CYBERTRON_PATH_ROOT}/3rdparty/artifactory/ffmpeg/include")
include_directories("${CYBERTRON_PATH_ROOT}/3rdparty/asio")
include_directories("${CYBERTRON_PATH_ROOT}/3rdparty/osi/osi3")
include_directories("${CYBERTRON_PATH_ROOT}/3rdparty")
include_directories("${CYBERTRON_PATH_ROOT}/3rdparty/SSD/include")

IF (WIN32)
	add_definitions(-D_WIN32_WINNT=0x0501)
ENDIF()

add_definitions(-DNOMINMAX)
add_definitions(-DUNICODE)
add_definitions(-D_UNICODE)
add_definitions(-DASIO_STANDALONE)
IF (MSVC)
	string(REPLACE "/MDd" "/MD" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
ENDIF()

file(GLOB srcs *.h *.hh *i *.hpp *.c *.cc *.cpp)
set(srcs ${srcs} Matlab/TaskSimulinkRun.hpp Matlab/TaskSimulinkRun.cpp)
IF (MSVC)
    file(GLOB simulink_srcs Simulink/*.hpp Simulink/*.cpp)
    set(srcs ${srcs} ${simulink_srcs})
ENDIF()
file(GLOB_RECURSE net_files "Net/*.cpp" "Net/*.hpp")
set(srcs ${srcs} ${net_files})

file(GLOB_RECURSE util_files "Util/*.cpp" "Util/*.hpp")
IF(UNIX)
list(FILTER util_files EXCLUDE REGEX "Util/Platform.*")
ENDIF()
set(srcs ${srcs} ${util_files})

file(GLOB_RECURSE task_files "Task/*.cpp" "Task/*.hpp" "Task/HotAreaTask/*.cpp" "Task/HotAreaTask/*.hpp"
"Task/SensorTask/*.cpp" "Task/SensorTask/*.hpp")
set(srcs ${srcs} ${task_files})

target_sources(CybertronBridgeIO PRIVATE ${srcs})
source_group(TREE ${CMAKE_CURRENT_LIST_DIR} FILES ${srcs})

SetDefaultTargetProperties(CybertronBridgeIO)

set(CURL_LIB_PATH ${CYBERTRON_PATH_ROOT}/3rdparty/libcurl)

target_link_libraries(CybertronBridgeIO debug CybertronBridgeBase)
target_link_libraries(CybertronBridgeIO debug CybertronSensorBase)


target_link_libraries(CybertronBridgeIO optimized CybertronBridgeBase)
target_link_libraries(CybertronBridgeIO optimized CybertronSensorBase)

IF (WIN32)
	#SET(FOUNDATION_DBG_LIB_PATH ${CYBERTRON_PATH_FOUNDATION}/Build/build/lib/Debug)

	#target_link_libraries(CybertronBridgeIO debug ${FOUNDATION_DBG_LIB_PATH}/CybertronBridgeBase.lib)
	#target_link_libraries(CybertronBridgeIO debug ${FOUNDATION_DBG_LIB_PATH}/CybertronSensorBase.lib)
	#target_link_libraries(CybertronBridgeIO debug ${FOUNDATION_DBG_LIB_PATH}/CybertronLogApi.lib)
	#target_link_libraries(CybertronBridgeIO debug ${FOUNDATION_DBG_LIB_PATH}/CybertronCore.lib)
	#target_link_libraries(CybertronBridgeIO debug ${FOUNDATION_DBG_LIB_PATH}/protobuf.lib)
	


	#SET(FOUNDATION_REL_LIB_PATH ${CYBERTRON_PATH_FOUNDATION}/Build/build/lib/Release)
	#target_link_libraries(CybertronBridgeIO optimized ${FOUNDATION_REL_LIB_PATH}/CybertronBridgeBase.lib)
	#target_link_libraries(CybertronBridgeIO optimized ${FOUNDATION_REL_LIB_PATH}/CybertronSensorBase.lib)
	#target_link_libraries(CybertronBridgeIO optimized ${FOUNDATION_REL_LIB_PATH}/CybertronCore.lib)
	#target_link_libraries(CybertronBridgeIO optimized ${FOUNDATION_REL_LIB_PATH}/protobuf.lib)
	#target_link_libraries(CybertronBridgeIO optimized ${FOUNDATION_REL_LIB_PATH}/CybertronLogApi.lib)
	#target_link_libraries(CybertronBridgeIO optimized ${SIMONE_PATH_ROOT}/3rdparty/SSD/lib/win64/release/SSD.lib)
	target_link_libraries(CybertronBridgeIO PSAPI.lib)

	target_link_libraries(CybertronBridgeIO
		ws2_32
		crypt32
		Wldap32
		Normaliz)
ELSEIF (UNIX)
	target_link_libraries(CybertronBridgeIO optimized  -lpthread -lrt -luuid)
ENDIF()

IF (MSVC)
  SET_PROPERTY(TARGET CybertronBridgeIO PROPERTY FOLDER "Worker")
ENDIF()



